# coding=utf-8

class QuestionBrute:
    def numberOf2sInRange(self, n):
        count = 0
        i = 2
        while i<=n:
            count += self.numberOf2s(i)
            i=i+1
        return count

    def numberOf2s(self, n):
        count = 0
        while (n > 0):
            if (n % n == 2):
                cout += 1
            n = n / 10
        return count


if __name__ == '__main__':
    questionBrute=QuestionBrute()
    print questionBrute.numberOf2sInRange(10)
